<template>
	<div class="addressList">
		<ul>
			<li class="addressList-item" v-for="item in addressList" @click="xzaddress(item.addr_id)">
				<p><span>{{item.consignee}}</span><span>{{item.phone_tel==null?item.phone_mob:item.phone_tel}}</span></p>
				<p><span v-show="item.is_default==1">[默认地址]</span>{{item.region_name}}{{item.address}}</p>
			</li>
			<!--<li class="addressList-item">
				<p><span>农淘优选</span><span>18888888888</span></p>
				<p><span>[默认地址]</span>浙江省杭州市余杭区云立方三号楼三号楼三号楼</p>
			</li>
			<li class="addressList-item">
				<p><span>农淘优选</span><span>18888888888</span></p>
				<p><span>[默认地址]</span>浙江省杭州市余杭区云立方三号楼三号楼三号楼</p>
			</li>-->
		</ul>
		<router-link class="guanlidizhi" to="/myaddress/addressgl">管理收货地址</router-link>
	</div>
</template>

<script>
	import addresslist from '../css/addresslist.css'
	
	var furl = 'http://www.ntyouxuan.com/'
	export default{
		name:"addresslist",
		data (){
			return{
				user:0,
				addressList:{}
			}
		},
		created:function(){
			this.user=localStorage.getItem("nt_user");
		},
		methods:{
			xzaddress:function(item){
				var self=this;
				$.ajax({
					type:'get',
					data:{'token':self.user,'addr_id':item},
					url:furl+'index.php?app=ajax&act=addr_view',
					dataType:'json',
					success:function(res){
						history.go(-1);
					}
				})
			}
		},
		mounted:function(){
			var self=this;
			console.log(self.user);
			$.ajax({
				type:"get",
				url:furl+'index.php?app=ajax&act=address',
				data:{'token':self.user},
				dataType:"json",
				success:function(res){
					console.log(res);
					self.addressList=res.retval;
				}
			})
		}
	}
</script>

<style>
</style>